<template>
	<view>
		<view class="login-card body-box">
			<view class="login-label" >用户名</view>
			<input v-model="user_name" placeholder="请输入用户名" class="login-input" />
		</view>
		<view class="login-btn" @tap="changePwd()">立即修改</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				user_name:""
			}
		},
		onLoad() {
			this.getData()
		},
		methods:{
			getData(){
				this.ajax('index/user',{
					success:(res) => {
						this.user_name = res.msg.user_name;
					}
				});
			},
			changePwd(){
				this.ajax('user/editInfo',{
					data:{
						user_name : this.user_name,
					},
					success:(res) => {
						this.toast(res.msg);
						if(res.code){
							uni.navigateBack()
						}
					}
				})
			},
		}
	}
</script>

<style>
	@import url("@/static/css/login/login.css");
</style>
